package com.itcast.demo_one.kotlin

// 1.基本函数
fun sum1(num1:Int,num2:Int): Int {
    return num1 + num2
}

// 2.函数表达式
fun sum2(num1:Int,num2:Int): Int = num1 + num2

// 3.默认参数
fun sum3(num1:Int,num2:Int,num3:Int = 10): Int {
    return num1 + num2 + num3
}
// 4.可以命名传参
fun intro(name:String,country:String = ""){
    println("name:$name,country:$country")
}

// 5.可变参数
fun sum4(vararg names :String){
    for (name in names){
        println(name)
    }
}


fun main(){
    println(sum1(10,20))
    println(sum2(100,200))
    intro(name="张三", country = "中国")
    sum4("张三","李四")
    sum4("张三","王五","赵六")
    println( sum3(10,20))
}